package miao.demo.dao.impl;

import miao.demo.dao.BookDao;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Repository("bookDao")
@Scope() //默认单例
public class BookDaoImpl implements BookDao {

    public BookDaoImpl() {
        System.out.println("construct....");
    }

    @Override
    public void save() {
        System.out.println("book dao save.....");
    }

    @PostConstruct //构造器之后跑
    public void init(){
        System.out.println("init...");
    }

    @PreDestroy //销毁前跑
    public void destroy(){
        System.out.println("destroy....");
    }
}
